import mockjs from 'mockjs'

const Mock = {
    // 模拟订单数据
    // type: 订单类型  0-普通订单 1-秒杀订单
    getOrder(type){
        let array = []
        for(let i=0;i<mockjs.Random.integer(5,15);i++){
            array.push(mockjs.mock({
                'name': type == 0 ? '普通商品' + i : '秒杀商品' + i,
                'price': mockjs.Random.integer(20,500) + '元',
                'buyer': mockjs.Random.cname(),
                'time': mockjs.Random.datetime('yyyy-MM-dd HH:mm:ss'),
                'role': mockjs.Random.boolean(),
                'state': mockjs.Random.boolean(),
                'payType': mockjs.Random.boolean(),
                'sourceType': mockjs.Random.url(),
                'phone': mockjs.mock(/\d{11}/)
            }))
        }
        return array;
    },
    // 模拟商品数据
    // type: 订单类型  0是普通商品，1是秒杀商品，2是今日推荐
    getGoods(type){
        let array = []
        for(let i=0;i<mockjs.Random.integer(5,10);i++){
            array.push(mockjs.mock({
                'name': (type == 0 ? '普通商品' : (type == 1 ? '秒杀商品' : '今日推荐')) + i,
                'img': mockjs.Random.dataImage('60x100','商品示例图'),
                'price': mockjs.Random.integer(20,500) + '元',
                'sellCount': mockjs.Random.integer(10,100),
                'count': mockjs.Random.integer(10,100),
                'back': mockjs.Random.integer(10,100),
                'backPrice': mockjs.Random.integer(0,5000) + '元',
                'owner': mockjs.Random.cname(),
                'time': mockjs.Random.datetime('yyyy-MM-dd HH:mm:ss'),               
                'state': mockjs.Random.boolean()
            }))
        }
        return array;
    },
    // 模拟店长数据
    getManagerList(){
        let array = []
        for(let i=0;i<mockjs.Random.integer(5,10);i++){
            array.push(mockjs.mock({
                'people': mockjs.Random.csentence(),
                'weixin': mockjs.Random.string(7,10),
                'state': mockjs.Random.boolean(),
                'income': mockjs.Random.integer(0,500000) + '元',               
                'back': mockjs.Random.integer(0,1000) + '元',
                'backPrice': mockjs.Random.integer(0,5000) + '元',
                'source': '站内',
                'customer': mockjs.Random.integer(0,50),
                'time': mockjs.Random.datetime('yyyy-MM-dd HH:mm:ss')                               
            }))
        }
        return array;
    },
    // 模拟店长审批列表数据
    getManagerReqList(){
        let array = []
        for(let i=0;i<mockjs.Random.integer(5,10);i++){
            array.push(mockjs.mock({
                'people': mockjs.Random.csentence(),                
                'state': mockjs.Random.boolean(),              
                'time': mockjs.Random.datetime('yyyy-MM-dd HH:mm:ss'),
                'addTime': mockjs.Random.datetime('yyyy-MM-dd HH:mm:ss'),                    
                
            }))
        }
        return array;
    },
    // 模拟店长订单列表数据
    getManagerOrderList(){
        let array = []
        for(let i=0;i<mockjs.Random.integer(5,10);i++){
            array.push(mockjs.mock({
                'orderType': '店长订单',
                'orderName': mockjs.Random.csentence(),
                'orderNumber': mockjs.mock(/\d{13}/),
                'people': mockjs.Random.cname(),   
                'count': mockjs.Random.integer(10,100),
                'price': mockjs.Random.integer(100,500) + '元',
                'price1': mockjs.Random.integer(20,100) + '元',             
                'state': mockjs.Random.boolean(),              
                'time': mockjs.Random.datetime('yyyy-MM-dd HH:mm:ss')                                                
            }))
        }
        return array;
    },
    // 模拟财务明细列表数据
    getFinancialDetailList(){
        let array = []
        for(let i=0;i<mockjs.Random.integer(5,10);i++){
            array.push(mockjs.mock({
                'orderType': '店长订单',
                'orderName': mockjs.Random.csentence(),
                'orderNumber': mockjs.mock(/\d{13}/),
                'name': mockjs.Random.cname(),               
                'payType': mockjs.Random.boolean(),              
                'time': mockjs.Random.datetime('yyyy-MM-dd HH:mm:ss')                                                
            }))
        }
        return array;
    },
     // 模拟财务对账单日汇总列表数据
     getTradeListDayList(){
        let array = []
        for(let i=0;i<mockjs.Random.integer(5,30);i++){
            array.push(mockjs.mock({
                'time': mockjs.Random.datetime('yyyy-MM-dd HH:mm:ss'),  
                'income': mockjs.Random.integer(100,500) + '元',
                'consume': mockjs.Random.integer(100,500) + '元',
                'remark': mockjs.Random.csentence()                                                                        
            }))
        }
        return array;
    },
     // 模拟财务对账单月汇总列表数据
     getTradeListMonthList(){
        let array = []
        for(let i=0;i<mockjs.Random.integer(15,30);i++){
            array.push(mockjs.mock({
                'time': mockjs.Random.datetime('yyyy-MM-dd HH:mm:ss'),  
                'income': mockjs.Random.integer(1000,3000) + '元',
                'consume': mockjs.Random.integer(1000,300) + '元',
                'remark': mockjs.Random.csentence()                                                 
            }))
        }
        return array;
    },
    // 模拟数据charts
    getChartsData() {
        let array = []
        for(let i=0;i<6;i++){
            array.push(mockjs.Random.integer(0,100))
        }
        return array;
    },
    getTradeData() {
        return mockjs.mock({
            'allTra': mockjs.Random.integer(10000,50000),
            'speTra': mockjs.Random.integer(0,5000),
            'norTra': mockjs.Random.integer(0,5000),
            'userCount': mockjs.Random.integer(0,1000),
            'managerCount': mockjs.Random.integer(0,100),
            'time': mockjs.Random.datetime('yyyy-MM-dd HH:mm:ss')
        })
    }
}

export default Mock;